package demo2;

import java.io.*;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-08-08
 * Time: 11:54
 */
public class TestDemo2 {

    public static void main(String[] args) throws IOException {
//        Reader reader = new FileReader("text.txt");
//        char[] chars = new char[1024];
//        int len = reader.read(chars);
//        for(int i =0;i<len;++i){
//            System.out.println(chars[i]);
//        }
//        reader.close();
        //最推荐的写法---文本文件
        //二进制文件---inputStream--一个字节一个字节
        InputStream inputStream = new FileInputStream("text.txt");
        Scanner scan = new Scanner(inputStream);
        String s = scan.next();
        System.out.println(s);
    }

}
